package com.muyu.common.core.utils.pay;

import com.muyu.common.core.constant.PayConstants;
import com.github.wxpay.sdk.WXPayConfig;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * @author sunqingfa
 * @create 2025-01-04 14:16
 */
public class WxPayConfigImpl implements WXPayConfig {
    private byte[] certData = null;
    private String appId;

    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Override
    public String getAppID() {
        return appId;
    }

    @Override
    public String getMchID() {
        return PayConstants.MCH_ID;
    }

    @Override
    public String getKey() {
        return PayConstants.API_V2_KEY;
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis;
        certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        // TODO Auto-generated method stub
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        // TODO Auto-generated method stub
        return 10000;
    }
}
